﻿@{
    ViewBag.Title = "Apple Push Notification";
}

<h2>@ViewBag.Title</h2>

<p>
        You can send Apple Push Notifications to an application in your iPhone, iPad, and iPod touch devices. For more information, you can check the 
        <a href="http://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ApplePushService/ApplePushService.html">Push Notification Service</a> 
        article in the <a href="http://developer.apple.com/library/ios/navigation">iOS Developer Library</a>.</p>

        <div>
            <h3>Notification</h3>
            <fieldset>
                <legend></legend>
                
                <div class="editor-label">
                    <label for="appleDeviceId">Device Id</label>
                </div>
                <div class="editor-field">
                    @Html.TextBox("appleDeviceId")
                    <span>The device id is analogous to a phone number; it contains information that enables APNs to locate the device on which the client application is installed.</span>
                </div>

                <div class="editor-label">
                    <label for="appleMessage">Message</label>
                </div>
                <div class="editor-field">
                    @Html.TextBox("appleMessage")
                </div>
                
                <div class="appleResults">
                    <input type="image" src="@Url.Content("~/Content/images/Send.png")" value="Send" onclick="SendAppleNotification(appleActionUrl)" />
                    <div class="status">
                        <img id="sendingNotificationStatus" src="/Content/images/sending.gif" alt="Sending push notification." title="Sending push notification." />
                        <img id="successNotificationStatus" src="/Content/images/success.png" alt="Notification successfully sent." title="Notification successfully sent." />
                        <img id="failedNotificationStatus" src="/Content/images/error.png" alt="An error has ocurred while sending the push notification." title="An error has ocurred while sending the push notification." />
                        <span id="messageStatus"></span>
                    </div>
                </div>
            </fieldset>
        </div>

        <p class="note"><strong>Note</strong>: In order to customize this page to send Apple Push Notifications to a specific iOS application, you first need to register within the <a href="http://developer.apple.com/devcenter/ios">iOS Developer Program</a> 
           and provision an SSL certificates from the <a href="https://developer.apple.com/devcenter/ios/my/overview/index.action">iPhone Provisioning Portal</a>. Once you have the SSL certificate for your iOS application, 
           you need to upload it to your Windows Azure Hosted Services and update the new thumprint in the ServiceConfiguration.cscfg file. For more information, you can check the 
           <a href="http://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ProvisioningDevelopment/ProvisioningDevelopment.html">Provisioning and Development</a> article in 
           the <a href="http://developer.apple.com/library/ios/navigation">iOS Developer Library</a>.</p>
<script type="text/javascript">
//<![CDATA[
    var appleActionUrl = '@this.Html.Raw(this.Url.Action("SendAppleMessage", new { deviceId = "_deviceId_", message = "_message_" }))';
//]]>
</script>


